#include<iostream>
#include<signal.h>
#include<unistd.h>

void handler(int signum)
{
    std::cout<<"I get a signal,signum:"<<signum<<std::endl;
        
}

int main()
{
    signal(SIGINT,handler);

    while(1)
    {
        std::cout<<"My pid is "<<getpid()<<std::endl;
        sleep(1);
    }

    return 0;
}